export default {
    daysbefore(number) {
            // 获取当前日期
const currentDate = new Date();

// 构建近一年日期数组
const sevenDaysArray = [];
for (let i = number-1; i >= 0; i--) {
  const date = new Date(currentDate);
  date.setDate(currentDate.getDate() - i);

  // 格式化日期为 "YYYY-MM-DD"
  const formattedDate = formatDate(date);
  
  sevenDaysArray.push(formattedDate);
    // 格式化日期函数
function formatDate(date) {
  const year = date.getFullYear();
  const month = (date.getMonth() + 1).toString().padStart(2, '0');
  const day = date.getDate().toString().padStart(2, '0');
  return `${year}-${month}-${day}`;
}
}

// 打印结果
console.log(sevenDaysArray[0]);
return sevenDaysArray[0]
    }
        
}